package com.service.vecc;

import com.common.ErrorCodeEnum;
import com.common.emums.DataStatus;
import com.common.exception.BusinessException;
import com.common.utils.StringUtils;
import com.core.springSecurity.common.SecurityUtils;

import com.dao.primary.vecc.VeccRequestLogInfoMapper;
import com.model.domain.vecc.GetVeccRequestLogInfoDO;
import com.model.pojo.vecc.VeccRequestLogInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;



/**
 * @Author: zql
 * @Description: 环保国四监控接口数据记录服务
 * @Data: 2024-02-21
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class VeccRequestLogInfoService {
    private final VeccRequestLogInfoMapper veccRequestLogInfoMapper;
    public List<VeccRequestLogInfo> getAllList(GetVeccRequestLogInfoDO getVeccRequestLogInfoDO){
        PageHelper.clearPage();
        PageHelper.orderBy(getVeccRequestLogInfoDO.getSortRow()+getVeccRequestLogInfoDO.getSortOrder());
        return veccRequestLogInfoMapper.selectList(getVeccRequestLogInfoDO);
    }
    public VeccRequestLogInfo getByRequestIdAndType(String requestId,Integer type){
        return veccRequestLogInfoMapper.selectByRequestIdAndType(requestId,type);
    }
    public int save(VeccRequestLogInfo info){
        info.setCreatedTime(new Date());
        return veccRequestLogInfoMapper.insertSelective(info);
    }
    public int update(VeccRequestLogInfo info){
        return veccRequestLogInfoMapper.updateByPrimaryKeySelective(info);
    }
}
